﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Xml.Serialization;

namespace AndreySmirnov.BLToolkitUtils.VSPackage.Model.Config
{
	public class BLTConfigFile
	{
		public BLTConfig Config { get; set; }

		public void Load(string fileName)
		{
			var serializer = new XmlSerializer(typeof(BLTConfig));
			using (var s = File.Open(fileName, FileMode.Open, FileAccess.ReadWrite))
			{
				Config = (BLTConfig)serializer.Deserialize(s);
			}
		}

		public void Save(string fileName)
		{
			using (var sw = new StreamWriter(fileName, false, Encoding.UTF8))
			{
				var serializer = new XmlSerializer(typeof(BLTConfig));
				serializer.Serialize(sw, Config);
			}
		}
	}
}
